from django.conf import settings
from django.contrib import admin
from django.urls import include, path

from polls import views

from rest_framework_simplejwt.views import (
    TokenObtainPairView,
    TokenRefreshView,
)
urlpatterns = [
    path('', views.show_subjects),
    path('api/subjects/caches/', views.api_subjects_caches),
    path('test/', views.test),
    path('api/subjects/', views.show_subjects_api),
    path('api/cbv/subjects/', views.SubjectView.as_view()),
    path('teachers/', views.show_teachers),
    path('login/', views.login),
    path('logout/', views.logout),
    path('captcha/', views.get_captcha),
    path('praise/', views.praise_or_criticize),
    path('criticize/', views.praise_or_criticize),
    path('admin/', admin.site.urls),
    path('excel/', views.export_teachers_excel),
    path('teachers_data/', views.get_teachers_data),
    path('api/teachers/', views.api_teachers),
    path('api/teachers_all/', views.api_teachers_all),
    path('api/get_mobilecode/', views.get_mobilecode),
    path('uploadToQiNiu/', views.uploadToQiNiu),
    path('api/token/', TokenObtainPairView.as_view(), name='token_obtain_pair'),
    path('api/token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
]
from rest_framework.routers import DefaultRouter

router = DefaultRouter()
router.register('api/cbv_all/subjects', views.SubjectViewSet)
urlpatterns += router.urls
if settings.DEBUG:

    import debug_toolbar

    urlpatterns.insert(0, path('__debug__/', include(debug_toolbar.urls)))